package com.csair.platform.cit.facade.model.citwgqyGrid.sy.vo;

import com.csair.invoice.common.base.util.collection.CollectionUtil;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Objects;

/**
 * 居民企业参股外国企业信息报告表 返回模型和请求模型
 * @author zhengxincheng
 */
@Data
public class CitWgqyGridItemVo {

    /**
     * 纳税人识别号
     */
    private String nsrsbh;
    /**
     * 税款所属日期起
     */
    private String skssqq;
    /**
     * 税款所属日期止
     */
    private String skssqz;

    private Long id;

    /**
     * 居民企业参股外国企业信息报告表-被投资外国企业信息
     */
    CitWgqyGridVo citWgqyGrid;

    /**
     * 被投资外国企业信息--持有外国企业10%以上股份或有表决权股份的其他股东情况
     */
    List<CitWgqyGridFb1Vo> citWgqyGridFb1;

    /**
     * 被投资外国企业信息--中国居民个人担任外国企业高管或董事情况
     */
    List<CitWgqyGridFb2Vo> citWgqyGridFb2;

    /**
     * 外国企业股份变动信息--报告人收购外国企业股份情况
     */
    List<CitWgqyGridFb3Vo> citWgqyGridFb3;

    /**
     *  外国企业股份变动信息--报告人处置外国企业股份情况
     */
    List<CitWgqyGridFb4Vo> citWgqyGridFb4;

    public CitWgqyGridVo getCitWgqyGrid() {
        if(!Objects.isNull(citWgqyGrid)){
            citWgqyGrid.setNsrsbh(nsrsbh);
            citWgqyGrid.setSkssqq(skssqq);
            citWgqyGrid.setSkssqz(skssqz);
        }
        return citWgqyGrid;
    }

    public void setParentId(Long id) {
        if(CollectionUtil.isNotEmpty(this.getCitWgqyGridFb1())){
            for (CitWgqyGridFb1Vo fb1: this.getCitWgqyGridFb1()) {
                fb1.setParentId(id);
            }
        }
        if(CollectionUtil.isNotEmpty(this.getCitWgqyGridFb2())){
            for (CitWgqyGridFb2Vo fb2: this.getCitWgqyGridFb2()) {
                fb2.setParentId(id);
            }
        }
        if(CollectionUtil.isNotEmpty(this.getCitWgqyGridFb3())){
            for (CitWgqyGridFb3Vo fb3: this.getCitWgqyGridFb3()) {
                fb3.setParentId(id);
            }
        }
        if(CollectionUtil.isNotEmpty(this.getCitWgqyGridFb4())) {
            for (CitWgqyGridFb4Vo fb4: this.getCitWgqyGridFb4()) {
                fb4.setParentId(id);
            }
        }

    }
}
